package com.yangrui.app.mapper;

import com.yangrui.app.entity.Episode;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EpisodeMapper {
    /**
     * 查询视频第一集
     * @param videoId videoId
     * @return Episode
     */
    @Select("select id ,title ,free, play_url, order_in_video, order_in_chapter, chapter_id, video_id, create_time" +
            " from lesson.episode where video_id=#{param1} and order_in_video = 1")
    Episode selectFirstEpisodeByVideoId(Integer videoId);

    /**
     * 根据章查询所有集
     * @param
     * @return 集的集合
     */
    @Select("select id ,title ,free, play_url, order_in_video, order_in_chapter, chapter_id, video_id, create_time" +
            " from lesson.episode where chapter_id=#{param1}")
    List<Episode> selectByChapterId(Integer id);


}
